home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
jabber1a
/
jabberwi.bas
< prev
next >
Wrap
BASIC Source File
|
1999-10-04
|
2KB
|
69 lines
Attribute VB_Name = "Jabber"
' Define new type
Type MyOptions
First As String * 1
MaxWordLen As String * 3
MinWordLen As String * 3
WordFile As String * 100
WordFinal As String * 10
WordInit As String * 10
End Type
Global Opt As MyOptions
Dim Con(100), Vow(100) ' Container for Consonants & Vowels
Public Function OpenLetters()
If Len(FrmJabber.TxtFileName.Text) = 0 Then Exit Function
' Open letters file
Open FrmJabber.TxtFileName.Text For Input As #1
' Set form caption
FrmJabber.Caption = App.Title + " " + "1.0" + ": " + StrConv(Left(ExtractFileName(FrmJabber.TxtFileName.Text), Len(ExtractFileName(FrmJabber.TxtFileName.Text)) - 4), vbProperCase)
Dim CNumber As Integer, VNumber As Integer, None As String
' Get contents of file
Line Input #1, None
' Check to see it's a valid letters file
If None <> "NUMBER OF CONSONANTS:" Then
MsgBox "Not a valid letters file", vbOKOnly, "Invalid file"
GoTo Cl
End If
Line Input #1, None
CNumber = None
Line Input #1, None
For i = 1 To CNumber
Line Input #1, Con(i)
FrmJabber.LstCon.AddItem Con(i)
Next
Line Input #1, None
Line Input #1, None
VNumber = None
Line Input #1, None
For i = 1 To VNumber
Line Input #1, Vow(i)
FrmJabber.LstVow.AddItem Vow(i)
Next
Cl:
Close
End Function
Public Function GRI(LowerBound, UpperBound) As Long
' Get Random seed based on current time & Date
Randomize Int(CDbl((Now))) + Timer
' Get Random number with the random seed
GRI = Int((UpperBound - LowerBound + 1) * Rnd + LowerBound)
End Function